<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:apabb="http://apabb.org.br/jsf"
	template="../template/template.xhtml">

	<ui:define name="nucleoBase">

		<h:form id="formBem">

			<div style="position: relative; left: 11px; font-size: 120%;">
				<h2>Manter Patrimonio</h2>
			</div>
			<hr size="3" style="left: 10px; background-color: #000080;" />

			<div id="idEditaPatrimonio">
				<div style="position: relative; left: 11px;">
					<h:messages
						errorStyle="color: red; font-family: Arial; 
								 position: relative; left: 10px; font-size: 12px; font-weight: bold;"
						infoClass="info" showSummary="true" />
				</div>
				<br />
				<fieldset styleClass="form"
					style="background-color: rgb(240, 250, 255)">
					<br />
					<h:panelGrid columns="2" width="73%">
					
						<h:column>
							<h:outputLabel for="tipo_pat" value="* Tipo: " />
						</h:column>
						<h:column>
							<h:selectOneMenu styleClass="inputContrast" name="tipo_pat"
								id="tipo_pat"
								value="#{patrimonioView.patrimonio.tipoPatrimonio}" required="true" label="Tipo">
								<f:selectItem itemLabel="- Selecione -"/>
								<f:selectItems value="#{patrimonioView.listaTipoPatrimonio}" />
							</h:selectOneMenu>
						</h:column>
						
						<h:column>
							<h:outputLabel for="nome" value="* Nome: " />
						</h:column>
						<h:column>
							<h:inputText value="#{patrimonioView.patrimonio.nomePatrimonio}" name="nome"
								required="true"
								id="nome" type="text" size="40" maxlength="70" label="Nome">
							</h:inputText>
						</h:column>
						
						<h:column>
							<h:outputLabel for="codigo" value="* Codigo: " />
						</h:column>
						<h:column>
							<h:inputText value="#{patrimonioView.patrimonio.codigoPatrimonio}" name="codigo"
								disabled="true" required="true"
								id="codigo" type="text" size="40" maxlength="70" label="Codigo">
							</h:inputText>
						</h:column>

						<h:column>
							<h:outputLabel for="marca" value="* Marca: " />
						</h:column>
						<h:column>
							<h:inputText value="#{patrimonioView.patrimonio.marca}" name="marca"
								required="true"
								id="marca" type="text" size="40" maxlength="70" label="Marca">
							</h:inputText>
						</h:column>
						
						<h:column>
							<h:outputLabel for="valor" value="* Valor: " />
						</h:column>
						<h:column>
							<h:inputText value="#{patrimonioView.patrimonio.valor}" name="valor"
								converter="#{valorConverter}" required="true"
								id="valor" type="text" size="40" maxlength="12" label="Valor"
								onkeyup="formataMascara('#.###.###,##', this)"
								onchange="formataMascara('#.###.###,##', this)">
							</h:inputText>
						</h:column>
						
						<h:column>
							<h:outputLabel for="setor" value="* Setor: " />
						</h:column>
						<h:column>
							<h:selectOneMenu disabled="#{patrimonioView.patrimonio.codigo == null}" name="setor" id="setor" required="true"
								value="#{patrimonioView.patrimonio.setor.codigo}" label="Setor">
								<f:selectItems value="#{patrimonioView.listaSetor}" />
							</h:selectOneMenu>

						</h:column>

					</h:panelGrid>

					<span style="color: red;">(*)Campo de preenchimento
						obrigatório.</span> <br />

					<div align="right">

						<table border="1" width="20%">
							<tr>
								<td><h:commandButton action="#{patrimonioView.voltar}"
										id="btnVoltar" immediate="true" value="   Voltar  "
										 /></td>
								<td>&nbsp;&nbsp;&nbsp;</td>
								<td><a4j:commandButton render="formBem"
										action="#{patrimonioView.popupSalvar}" id="btnSalvar"
										rendered="#{patrimonioView.patrimonio.codigo == null}"
										value="  Incluir  " /> <a4j:commandButton
										render="formBem" action="#{patrimonioView.popupAtualizar}"
										id="btnSalvar2"
										rendered="#{patrimonioView.patrimonio.codigo != null and patrimonioView.perfilGestor}"
										value="  Alterar  " /></td>
							</tr>

						</table>
					</div>

				</fieldset>


			</div>

			<apabb:popupConfirmacao componentView="#{patrimonioView}"
				form="formBem" />

		</h:form>
	</ui:define>
</ui:composition>
